package by.pavlyukevich.paymentsystem.datamodel.payment;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import by.pavlyukevich.paymentsystem.datamodel.AbstractEntity;
import by.pavlyukevich.paymentsystem.datamodel.Transaction;

@Entity
public class Payment extends AbstractEntity<Integer> {

	@ManyToOne(fetch = FetchType.LAZY)
	private Period period;

	@ManyToOne(fetch = FetchType.LAZY)
	private PaymentDetail paymentDetail;

	@OneToMany(mappedBy = "payment", cascade = { CascadeType.ALL })
	private Set<Counter> counters;

	@OneToMany(mappedBy = "payment", cascade = { CascadeType.ALL })
	private Set<Subsum> subsums;

	@OneToMany(mappedBy = "payment")
	private Set<Transaction> transactions;

	public Set<Transaction> getTransactions() {
		return transactions;
	}

	public void setTransactions(Set<Transaction> transactions) {
		this.transactions = transactions;
	}

	public Set<Counter> getCounters() {
		return counters;
	}

	public void setCounters(Set<Counter> counters) {
		this.counters = counters;
	}

	public Set<Subsum> getSubsums() {
		return subsums;
	}

	public void setSubsums(Set<Subsum> subsums) {
		this.subsums = subsums;
	}

	public Period getPeriod() {
		return period;
	}

	public void setPeriod(Period period) {
		this.period = period;
	}

	public PaymentDetail getPaymentDetail() {
		return paymentDetail;
	}

	public void setPaymentDetail(PaymentDetail paymentDetail) {
		this.paymentDetail = paymentDetail;
	}

}
